# 换源，并且安装软件

lsb_release -a | grep focal
if [ $? -eq 0 ]
then
    cp /etc/apt/sources.list /etc/apt/sources.list.cp
    cat > /etc/apt/sources.list <<- EOF
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
EOF
    
fi

lsb_release -a | grep bionic
if [ $? -eq 0 ]
then
    cp /etc/apt/sources.list /etc/apt/sources.list.cp
    cat > /etc/apt/sources.list <<- EOF
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

EOF
    
fi

sudo apt update
sudo apt upgrade
sudo apt install git
sudo apt install zsh
sudo apt install wget
sudo apt install gcc
sudo apt install g++
sudo apt install gdb

# 安装 zsh
cd ~

git clone https://gitee.com/mirrors/oh-my-zsh.git

mv oh-my-zsh .oh-my-zsh

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

# 安装 go, 配置镜像

cd ~
mkdir download
cd download
wget https://studygolang.com/dl/golang/go1.17.2.linux-amd64.tar.gz
tar -zxvf go1.17.2.linux-amd64.tar.gz
sudo mv go /usr/local

sudo ln -s /usr/local/go/bin/go /usr/bin

echo 'export GOROOT=/usr/local/go' >> ~/.zshrc
echo 'export GOPATH=~/go' >> ~/.zshrc
echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> ~/.zshrc
source ~/.zshrc

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

# 安装 python3，更新 pip 源头 
sudo apt install python3-pip
sudo apt install python3-venv
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

zsh
chsh -s /bin/zsh

